package com.wmuj.controller;

import com.wmuj.pojo.JobOption;
import com.wmuj.pojo.Result;
import com.wmuj.pojo.StudentOption;
import com.wmuj.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RequestMapping("/report")
@RestController
public class ReportController {

  @Autowired private ReportService reportService;

  /** 统计各个职业的员工人数 */
  @GetMapping("/empJobData")
  public Result getEmpJobData() {
    log.info("统计各个职业的员工人数....");
    JobOption joboption = reportService.getEmpJobData();
    return Result.success(joboption);
  }

  /** 统计员工性别 */
  @GetMapping("/empGenderData")
  public Result getEmpGenderData() {
    log.info("统计员工性别....");
    List<Map> genderList = reportService.getEmpGenderData();
    return Result.success(genderList);
  }

  /** 统计学员学历统计 */
  @GetMapping("/studentDegreeData")
  public Result getStudentDegreeData() {
    log.info("统计学员学历统计....");
    List<Map> degreeList = reportService.getStudentDegreeData();
    return Result.success(degreeList);
  }

  /** 班级人数统计 */
  @GetMapping("/studentCountData")
  public Result getStudentCountData() {
    log.info("班级人数统计....");
    StudentOption studentOption = reportService.getStudentCountData();
    return Result.success(studentOption);
  }
}
